Music Object Extension - Snapshots

  Contents

About This Extension

The Snapshots extension provides methods for easily capturing and restoring mix snapshots for RMF and MIDI files that are playing - something that can prove quite useful when creating certain kinds of remixing applications.

What's New in the Latest Version

There is a dedicated version history for this extension, where you will be able to find out about the new features and possible issues with the most recent version. The version history for this extension is independent of the version history for the core Music Object API.

Getting This Extension

To get the "music-object-x-snapshots.js" JavaScript file that implements this extension, simply right-click on this link (click-and-hold for Mac users). Then, from the menu that pops up, select the 'Save Link As...' or 'Save Target As...' option and save the file as "music-object-x-snapshots.js" into an appropriate folder of the local copy of your Web site.

In case you have problems saving the file using the above link, the "music-object-x-snapshots.js" file can also be found inside the documentation's "javascript" folder, along with the "music-object.js" file.

Dependencies

In order to use this extension, the following JavaScript file(s) must first be sourced in...

For more information on using extensions, consult the section About Music Object Extensions.

Reference

 Name   Short Description 
Instance Methods
captureSnapshot Lets you capture a snapshot of the current playback state for an RMF or MIDI file.
getSnapshotFilter Returns a string value, representing the current filter settings being used for the specified snapshot.
isSnapshotDefined Returns a boolean value, indicating whether or not there exists a snapshot by the specified name.
recallSnapshot Lets you recall the specified snapshot, so that the Music Object instance is restored to the playback state captured by that snapshot.
removeSnapshot Lets you remove (clear) the snapshot of the specified name.
resetSnapshotFilter Lets you reset the filter settings for the specified snapshot, so that either all or none of the filter options are enabled.
setSnapshotFilter Lets you set the filter settings for the specified snapshot.
Static Properties
Music.defaultSnapshotFilter A string variable, specifying the default value that should be used for the SnapshotFilterSTR parameter, if this parameter is not specified when using the captureSnapshot and setSnapshotFilter instance methods.
Common Parameters
SnapshotFilterSTR A string, specifying the enabled state for the various available snapshot filter options.

Instance Methods

 captureSnapshot

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Snapshots 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The captureSnapshot instance method lets you capture a snapshot of the current playback state for an RMF or MIDI file.

SYNTAX    captureSnapshot ( SnapshotNameSTR , SnapshotFilterSTR )

SPECIAL VALUES
VARIATIONS
 getSnapshotFilter

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Snapshots 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The getSnapshotFilter instance method returns a string value, representing the current filter settings being used for the specified snapshot.

SYNTAX    getSnapshotFilter ( SnapshotNameSTR )

RETURN VALUE    SnapshotFilterSTR

Filter settings can be easily copied from one snapshot to another using a combination of the getSnapshotFilter and setSnapshotFilter methods, as in the example...

myMusicObject.setSnapshotFilter (
   'My Snapshot 2',
   myMusicObject.getSnapshotFilter ('My Snapshot 1')
);

In this example, we are calling the setSnapshotFilter method in order to set the filter for the snapshot named "My Snapshot 2". For the SnapshotFilterSTR parameter of the setSnapshotFilter method we are passing the result of the expression myMusicObject.getSnapshotFilter ('My Snapshot 1'), which retrieves the filter from the snapshot named "My Snapshot 1". This has the effect of copying the filter for the snapshot "My Snapshot 1" to the snapshot "My Snapshot 2".

NOTES
 isSnapshotDefined

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Snapshots 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The isSnapshotDefined instance method returns a boolean value, indicating whether or not there exists a snapshot by the specified name.

SYNTAX    isSnapshotDefined ( SnapshotNameSTR )

RETURN VALUE    boolean

 recallSnapshot

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Snapshots 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The recallSnapshot instance method lets you recall the specified snapshot, so that the Music Object instance is restored to the playback state captured by that snapshot.

SYNTAX    recallSnapshot ( SnapshotNameSTR , SnapshotFilterSTR )

SPECIAL VALUES
VARIATIONS
 removeSnapshot

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Snapshots 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The removeSnapshot instance method lets you remove (clear) the snapshot of the specified name.

SYNTAX    removeSnapshot ( SnapshotNameSTR )

Once a snapshot has been removed using this method, any attempt to recall it using the recallSnapshot instance method will fail and will simply be ignored.

 resetSnapshotFilter

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Snapshots 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The resetSnapshotFilter instance method lets you reset the filter settings for the specified snapshot, so that either all or none of the filter options are enabled.

SYNTAX    resetSnapshotFilter ( SnapshotNameSTR , ResetStateSTR )

When a string value of "ON", "1", or "TRUE" is specified for the ResetStateSTR parameter, then the filter will be reset so that all filter options are enabled. And when a string value of "OFF", "0", or "FALSE" is specified for the ResetStateSTR parameter, then the filter will be reset so that all filter options are disabled.

VARIATIONS
 setSnapshotFilter

 
 CATEGORY   Instance Method 
 MODULE   Music Object Extension - Snapshots 
 Min. Player Version   1.0.0 
 File Types Supported   RMF, MIDI 
 

The setSnapshotFilter instance method lets you set the filter settings for the specified snapshot

SYNTAX    setSnapshotFilter ( SnapshotNameSTR , SnapshotFilterSTR )

SPECIAL VALUES
VARIATIONS
NOTES
Static Properties

 Music.defaultSnapshotFilter

 
 CATEGORY   Static Property 
 MODULE   Music Object Extension - Snapshots 
 Type   string 
 Default Value   -- see below -- 
 Access   read / write 
 

The Music.defaultSnapshotFilter static property is a string variable, specifying the default value that should be used for the SnapshotFilterSTR parameter, if this parameter is not specified when using the captureSnapshot and setSnapshotFilter instance methods.

The default value for the Music.defaultSnapshotFilter property is "CHANNELMUTE=ON CHANNELSOLO=ON CHANNELMODULATION=ON CHANNELVOLUME=ON CHANNELPAN=ON CHANNELEXPRESSION=ON CHANNELSUSTAIN=ON CHANNELREVERBTYPE=ON CHANNELREVERBLEVEL=ON CHANNELCHORUSLEVEL=ON POSITION=ON TEMPO=ON TRANSPOSE=ON VOLUME=ON".

Common Parameters

 SnapshotFilterSTR

 
 CATEGORY   Parameter 
 Type   string 
 

The SnapshotFilterSTR parameter is a string, specifying the enabled state for the various available snapshot filter options.


The syntax of the SnapshotFilterSTR parameter is much like that of the EmbedLineSTR parameter that is used by the various embedding methods of the Music Object API, and consists of a series of name/value pairs seperated by whitespace. Each name/value pair has the syntax...

FilterOptionName=[ON|1|TRUE|OFF|0|FALSE]

The values "ON", "1", and "TRUE" all have the same meaning and indicate that the filter option will be enabled. Similarly, the values "OFF", "0", and "FALSE" all have the same meaning and indicate that the filter option will be disabled.

So, for example, the value "CHANNELPAN=ON TEMPO=OFF POSITION=FALSE TRANSPOSE=1" for the SnapshotFilterSTR parameter specifies that the filter options for channel pan and transposition are enabled, whereas the filter options for tempo and position are disabled.

For the SnapshotFilterSTR parameter, the following filter option names can be specified...

NOTES